﻿/* 
 * This program is FREE to use as you like,
 * Edit it, re-build it, what ever you want.
 * But please, do not change these comments. 
 * And do NOT, in anyway, obfuscate this code..
 * You are allowed to use part of the code for your own work, but give me (purefmwc) credits.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;

namespace CSharpBot
{
    class Program
    {
        static string botName = "";

        static void Main(string[] args)
        {
            CreateSettingsIfNotExists();
   
            INIFile ini = new INIFile(@Environment.CurrentDirectory + @"\Settings.ini");
            botName = ini.Read("bot", "name");
            botName = "FML";

            if (botName == "QuoteBot")
            {
                QuoteBot.init(); //This command initializes the bot!
            }
            else if (botName == "FML")
            {
                FMLBot.init(); //This command initializes the bot!
            }
            else if (botName == "Lolisuite")
            {
                Lolisuite.init();  //This command initializes the bot!
            }
            else if (botName == "RandomBot")
            {
                RandomBot.init();
            }
            else
            {
                Console.WriteLine("No such bot!");
            }
        }

        /// <summary>
        /// This function will check if Settings.ini exists
        /// if not, it will be created with default settings.
        /// </summary>
        private static void CreateSettingsIfNotExists()
        {
            if (!File.Exists(@Environment.CurrentDirectory + @"\Settings.ini"))
            {
                StreamWriter sw = new StreamWriter(@Environment.CurrentDirectory + @"\Settings.ini");

                sw.WriteLine("; There are 3 kind of bots I've implemented.");
                sw.WriteLine("; Those are: QuoteBot, FML, and Lolisuite");
                sw.WriteLine("; Soon:");
                sw.WriteLine("; - IRCBot");
                sw.WriteLine("; - ????");
                sw.WriteLine("[bot]");
                sw.WriteLine("name=QuoteBot");
                sw.WriteLine();
                sw.WriteLine("[QuoteBot]");
                sw.WriteLine("Quotes=5");
                sw.WriteLine();
                sw.WriteLine("[FML]");
                sw.WriteLine("FMLs=0");
                sw.WriteLine();
                sw.WriteLine("[Lolisuite]");
                sw.WriteLine("LastTimeUsedLoliCommand=0");
                sw.WriteLine("Lolis=0");
                sw.WriteLine("LastTimeUsedShotaCommand=1");
                sw.WriteLine("Shotas=0");
                sw.WriteLine("LastTimeUsedPantsuCommand=1");
                sw.WriteLine("Pantsus=0");
                sw.WriteLine("LastTimeUsedOneeCommand=1");
                sw.WriteLine("Onee-sans=0");
                sw.WriteLine("LastTimeUsedImoutoCommand=1");
                sw.WriteLine("Imoutos=0");
                sw.WriteLine();

                sw.Close();
                sw.Dispose();
            }
        }
    } 
}
